using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BootyBay.Models.Mapping
{
    public class ApplicationPublicMap : EntityTypeConfiguration<ApplicationPublic>
    {
        public ApplicationPublicMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.StoreHttpUrl)
                .IsRequired()
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("ApplicationPublic");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Id_ApplicationInfo).HasColumnName("Id_ApplicationInfo");
            this.Property(t => t.StoreHttpUrl).HasColumnName("StoreHttpUrl");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Subcategory).HasColumnName("Subcategory");
            this.Property(t => t.OperationDate).HasColumnName("OperationDate");

            // Relationships
            this.HasRequired(t => t.ApplicationInfo)
                .WithMany(t => t.ApplicationPublics)
                .HasForeignKey(d => d.Id_ApplicationInfo);

        }
    }
}
